package com.yilijk.dialog;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.ArrayList;

/**
 * Created by SHICHENG
 * <p>
 * Time on 2021/11/08
 */
public class AlertDialogConfig implements Parcelable {

    public int type;
    //1 底部弹出 保存图片
    // 2 协议 同意 拒绝样式
    public boolean isAlpha = false;
    public int alpha;
    public ArrayList<String> listBeans;
    public String NEGATIVE_BUTTON_NAME;
    public String POSITIVE_BUTTON_NAME;
    public String title;
    public String content;

    public AlertDialogConfig() {
    }

    protected AlertDialogConfig(Parcel in) {
        this.type = in.readInt();
        this.isAlpha = in.readByte() != 0;
        this.alpha = in.readInt();
        this.listBeans = in.createStringArrayList();
        this.NEGATIVE_BUTTON_NAME = in.readString();
        this.POSITIVE_BUTTON_NAME = in.readString();
        this.title = in.readString();
        this.content = in.readString();

    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.type);
        dest.writeByte(this.isAlpha ? (byte) 1: ( byte) 0);
        dest.writeInt(this.alpha);
        dest.writeStringList(this.listBeans);
        dest.writeString(this.NEGATIVE_BUTTON_NAME);
        dest.writeString(this.POSITIVE_BUTTON_NAME);
        dest.writeString(this.title);
        dest.writeString(this.content);
    }

    public static final Creator<AlertDialogConfig> CREATOR = new Creator<AlertDialogConfig>() {
        @Override
        public AlertDialogConfig createFromParcel(Parcel in) {
            return new AlertDialogConfig(in);
        }

        @Override
        public AlertDialogConfig[] newArray(int size) {
            return new AlertDialogConfig[size];
        }
    };
}
